with System;

package body FT2.Stroker is

   -----------------
   -- Stroker_New --
   -----------------

   procedure Stroker_New
     (Library : FT_Library;
      Stroker : out FT_Stroker;
      Error : out FT_Error)
   is
      function Internal
        (Library : FT_Library;
         Stroker : System.Address)
         return FT_Error;
      pragma Import (C, Internal, "FT_Stroker_New");
   begin
      Error := Internal (Library, Stroker'Address);
   end Stroker_New;

   -------------------
   -- Parse_Outline --
   -------------------

   procedure Parse_Outline
     (Stroker : FT_Stroker;
      Outline : FT_Outline;
      Opened : Boolean;
      Error : out FT_Error)
   is
      function Internal
        (Stroker : FT_Stroker;
         Outline : FT_Outline;
         Opened : FT_Bool)
         return FT_Error;
      pragma Import (C, Internal, "FT_Stroker_ParseOutline");
   begin
      Error := Internal (Stroker, Outline, Boolean'Pos (Opened));
   end Parse_Outline;

   --------------------
   -- Begin_Sub_Path --
   --------------------

   procedure Begin_Sub_Path
     (Stroker : FT_Stroker;
      To : FT_Vector;
      Open : Boolean;
      Error : out FT_Error)
   is
      function Internal
        (Stroker : FT_Stroker;
         To : FT_Vector;
         Open : FT_Bool)
         return FT_Error;
      pragma Import (C, Internal, "FT_Stroker_BeginSubPath");
   begin
      Error := Internal (Stroker, To, Boolean'Pos (Open));
   end Begin_Sub_Path;

   ------------------
   -- End_Sub_Path --
   ------------------

   procedure End_Sub_Path
     (Stroker : FT_Stroker;
      Error : out FT_Error)
   is
      function Internal
        (Stroker : FT_Stroker)
         return FT_Error;
      pragma Import (C, Internal, "FT_Stroker_EndSubPath");
   begin
      Error := Internal (Stroker);
   end End_Sub_Path;

   -------------
   -- Line_To --
   -------------

   procedure Line_To
     (Stroker : FT_Stroker;
      To : FT_Vector;
      Error : out FT_Error)
   is
      function Internal
        (Stroker : FT_Stroker;
         To : FT_Vector)
         return FT_Error;
      pragma Import (C, Internal, "FT_Stroker_LineTo");
   begin
      Error := Internal (Stroker, To);
   end Line_To;

   --------------
   -- Conic_To --
   --------------

   procedure Conic_To
     (Stroker : FT_Stroker;
      Control : FT_Vector;
      To : FT_Vector;
      Error : out FT_Error)
   is
      function Internal
        (Stroker : FT_Stroker;
         Control : FT_Vector;
         To : FT_Vector)
         return FT_Error;
      pragma Import (C, Internal, "FT_Stroker_ConicTo");
   begin
      Error := Internal (Stroker, Control, To);
   end Conic_To;

   --------------
   -- Cubic_To --
   --------------

   procedure Cubic_To
     (Stroker : FT_Stroker;
      Control1 : FT_Vector;
      Control2 : FT_Vector;
      To : FT_Vector;
      Error : out FT_Error)
   is
      function Internal
        (Stroker : FT_Stroker;
         Control1 : FT_Vector;
         Control2 : FT_Vector;
         To : FT_Vector)
         return FT_Error;
      pragma Import (C, Internal, "FT_Stroker_CubicTo");
   begin
      Error := Internal (Stroker, Control1, Control2, To);
   end Cubic_To;

   -----------------------
   -- Get_Border_Counts --
   -----------------------

   procedure Get_Border_Counts
     (Stroker : FT_Stroker;
      Border : FT_Stroker_Border;
      Num_Points : out FT_UInt;
      Num_Contours : out FT_UInt;
      Error : out FT_Error)
   is
      function Internal
        (Stroker : FT_Stroker;
         Border : FT_Stroker_Border;
         Num_Points : System.Address;
         Num_Contours : System.Address)
         return FT_Error;
      pragma Import (C, Internal, "FT_Stroker_GetBorderCounts");
   begin
      Error := Internal (Stroker,
                         Border,
                         Num_Points'Address,
                         Num_Contours'Address);
   end Get_Border_Counts;

   ----------------
   -- Get_Counts --
   ----------------

   procedure Get_Counts
     (Stroker : FT_Stroker;
      Num_Points : out FT_UInt;
      Num_Contours : out FT_UInt;
      Error : out FT_Error)
   is
      function Internal
        (Stroker : FT_Stroker;
         Num_Points : System.Address;
         Num_Contours : System.Address)
         return FT_Error;
      pragma Import (C, Internal, "FT_Stroker_GetCounts");
   begin
      Error := Internal (Stroker, Num_Points'Address, Num_Contours'Address);
   end Get_Counts;

   ------------
   -- Stroke --
   ------------

   procedure Stroke
     (Glyph : in out FT_Glyph;
      Stroker : FT_Stroker;
      Destroy : Boolean;
      Error : out FT_Error)
   is
      function Internal
        (Glyph : System.Address;
         Stroker : FT_Stroker;
         Destroy : FT_Bool)
         return FT_Error;
      pragma Import (C, Internal, "FT_Glyph_Stroke");
   begin
      Error := Internal (Glyph'Address, Stroker, Boolean'Pos (Destroy));
   end Stroke;

   -------------------
   -- Stroke_Border --
   -------------------

   procedure Stroke_Border
     (Glyph : in out FT_Glyph;
      Stroker : FT_Stroker;
      Inside : Boolean;
      Destroy : Boolean;
      Error : out FT_Error)
   is
      function Internal
        (Glyph : System.Address;
         Stroker : FT_Stroker;
         Inside : FT_Bool;
         Destroy : FT_Bool)
         return FT_Error;
      pragma Import (C, Internal, "FT_Glyph_StrokeBorder");
   begin
         Error := Internal (Glyph'Address,
                            Stroker,
                            Boolean'Pos (Inside),
                            Boolean'Pos (Destroy));
   end Stroke_Border;

end FT2.Stroker;
